<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>load02</title>
    <script type="text/javascript">
        var btn = document.getElementById("btnId");
        btn.onclick = function () {
            alert("hello")
        };
    </script>
</head>
<body>
<button id="btnId">SayHello</button>
</body>
</html>
<!-- 2.写到script标签中，script标签放到head标签中，无法获取按钮对象 -->
